<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>toArray</title>
</head>

<body>
    <div>打开浏览器查看结果</div>
    <script>
        const toArray = (value = '') =>
            Array.from ? Array.from(value) : Array.prototype.slice.call(value);
        console.log(toArray('foo'));
    </script>
</body>

</html>